package com.ljw.hmall.order.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitMqConfig {

    @Bean
    public Queue normalQueue(){
        System.out.println("消费者启动....");
        return QueueBuilder
                .durable("normal.queue")
                .deadLetterExchange("delay.direct")  //普通队列指定死信交换机
                .deadLetterRoutingKey("ttl") //指定死信交换机与死信队列的routingKey
                .build();
    }

    @Bean
    public DirectExchange normalExchange(){
        return new DirectExchange("normal.direct");
    }

    @Bean
    public Binding binding(){
        return BindingBuilder.bind(normalQueue()).to(normalExchange()).with("ttl");
    }




}
